# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=lua-date
_rockname=date
pkgver=2.1.2
pkgrel=1
pkgdesc="Date & Time module for Lua 5.x"
url="https://github.com/Tieske/date"
arch="noarch"
license="MIT"
depends="lua"
checkdepends="lua-busted luajit"
source="https://github.com/Tieske/$_rockname/archive/version_$pkgver/lua-date-$pkgver.tar.gz"
builddir="$srcdir/date-version_$pkgver"

_luaversions="5.1 5.2 5.3"
for _v in $_luaversions; do
	checkdepends="$checkdepends lua$_v lua$_v-busted"
done

check() {
	local lver; for lver in $_luaversions jit; do
		msg "Testing on lua$lver"
		lua$lver /usr/bin/busted
	done
}

package() {
	local rockdir="$pkgdir/usr/lib/luarocks/rocks-common/$_rockname/$pkgver-1"

	install -m 644 -D "$builddir"/date.lua \
		"$pkgdir"/usr/share/lua/common/date.lua

	mkdir -p "$rockdir"
	echo 'rock_manifest = {}' > "$rockdir"/rock_manifest
}

sha512sums="78b85b05e2d3b41af024baae83b29f4deadbf2501d6a8c50017f9bc4125c53c83c821e415536b4b9f35b6025051af3d8e24eb93e47b0f36eeec62444c03ed364  lua-date-2.1.2.tar.gz"
